import { createBrowserRouter } from "react-router-dom"
import CompanyList from "../views/CompanyList"
import  {ErrorPage}  from "../views/Error"
import AddCompanyList from "../views/AddCompanyList"
import App from "../App"
import HistoryList from "../views/HistoryList"
import CreatePay from "../views/CreatePay"
import Demo from '../Demo'

const router = createBrowserRouter([
  {
    path:'/',
    element:<App />,
    children:[
      {
        index:true,
        element:<CompanyList />
      },
      {
        path:'/add',
        element:<AddCompanyList />,
        errorElement:<ErrorPage />
      },
      {
        path:'/list',
        element:<CompanyList />,
        errorElement:<ErrorPage />
      },
      {
        path:'/create',
        element:<CreatePay />,
        errorElement:<ErrorPage />
      },
      {
        path:'/history',
        element:<HistoryList />,
        errorElement:<ErrorPage />
      },
      {
        path:'/demo',
        element:<Demo />,
        errorElement:<ErrorPage />
      },
      // history
    ],
    errorElement:<ErrorPage />
  },
])

// const router = createBrowserRouter([
//   {
//     path:'/',
//     element:<AddCompanyList />,
//     children:[
//       // {
//       //   path:'/add',
//       //   element:<AddCompanyList />,
//       //   errorElement:<ErrorPage />
//       // },
//       {
//         path:'/list',
//         element:<CompanyList />,
//         errorElement:<ErrorPage />
//       },
//     ],
//     errorElement:<ErrorPage />
//   },
// ])

export { router }